package bb.lanxing.lib.devices.ble.ble.characteristic.light;

import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleCharacteristic;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleService;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

public final class LightFeatureCharacteristics extends BaseBleCharacteristic {
    private LightFeature lightFeature;

    public LightFeatureCharacteristics(BaseBleService bleService) {
        super(bleService);
        Intrinsics.checkNotNullParameter(bleService, "bleService");
    }

    public LightFeature getLightFeature() {
        return this.lightFeature;
    }

    public void setLightFeature(LightFeature lightFeature) {
        this.lightFeature = lightFeature;
    }

    @Override
    public UUID targetUUID() {
        UUID fromString = UUID.fromString("8CE5DD01-0A4D-11E9-AB14-D663BD873D93");
        Intrinsics.checkNotNullExpressionValue(fromString, "fromString(BLEAttributes.BLE_LIGHT_FEATURES)");
        return fromString;
    }

    @Override
    public void onValueUpdate(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
        Intrinsics.checkNotNullParameter(gatt, "gatt");
        Intrinsics.checkNotNullParameter(characteristic, "characteristic");
        byte[] value = characteristic.getValue();
        Intrinsics.checkNotNullExpressionValue(value, "characteristic.value");
        this.lightFeature = new LightFeature(value);
        StringBuilder sb = new StringBuilder();
        sb.append("LightFeatureCharacteristics LightFeature onValueUpdate :\nlightTypeSet: ");
        LightFeature lightFeature = this.lightFeature;
        LightColor lightColor = null;
        sb.append(lightFeature != null ? lightFeature.getLightTypeSet() : null);
        sb.append("\nlightModeSet: ");
        LightFeature lightFeature2 = this.lightFeature;
        sb.append(lightFeature2 != null ? lightFeature2.getLightModeSet() : null);
        sb.append("\nlightBeamMode: ");
        LightFeature lightFeature3 = this.lightFeature;
        sb.append(lightFeature3 != null ? lightFeature3.getLightBeamMode() : null);
        sb.append("\nlightBeamFocus: ");
        LightFeature lightFeature4 = this.lightFeature;
        sb.append(lightFeature4 != null ? lightFeature4.getLightBeamFocus() : null);
        sb.append("\nlightIntensity: ");
        LightFeature lightFeature5 = this.lightFeature;
        sb.append(lightFeature5 != null ? lightFeature5.getLightIntensity() : null);
        sb.append("\nlightColor: ");
        LightFeature lightFeature6 = this.lightFeature;
        if (lightFeature6 != null) {
            lightColor = lightFeature6.getLightColor();
        }
        sb.append(lightColor);
        log(sb.toString());
    }
}
